<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/content/mytags.jsp"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>菜单列表</title>
		<t:resource types="jquery,lhgdialog,easyui" />
	</head>
	<body>
		<div id="dict-layout" class="easyui-layout" fit="true">
			<div data-options="region:'center',border:false">
				<ui:treegrid name="menuList" idField="id" treeField="permiName" action="permission.do?treegrid&permiType=1" sortName="permiOrder" sortOrder="asc" title="菜单列表">
					<ui:column field="id" title="编码" sortable="false" width="80" hidden="true" />
					<ui:column field="permiName" title="菜单名称" sortable="false" width="130" query="true" />
					<ui:column field="permiCode" title="菜单编码" hidden="true" width="80" sortable="false" query="true" />
					<ui:column field="permiIcon" title="菜单图标" sortable="false" width="80" hidden="true" />
					<ui:column field="permiDepict" title="菜单描述" hidden="true" width="80" sortable="false" />
					<ui:column field="permiType" title="菜单类型" dictionary="permiType" width="100" sortable="false" />
					<ui:column field="permiOrder" title="菜单排序" width="80" sortable="false" />
					<ui:column field="permiUrl" title="访问URL" width="160" sortable="false" />
					<ui:column field="opt" title="操作" align="center" />
					<ui:deleteOpt title="删除菜单" permiCode="system:menu:delete" url="permission.do?delete&id={id}" message="确定要删除菜单[{permiName}]吗？" />
					<ui:funcOpt title="权限管理" permiCode="system:permission:datagrid:view" funname="viewPermission({id},{permiName})" />
					<ui:toolbar iconCls="add" permiCode="system:menu:save" title="新增菜单" url="permission.do?menu" funname="addMenu" height="350px" />
					<ui:toolbar iconCls="edit" permiCode="system:menu:save" title="编辑菜单" url="permission.do?menu" funname="update" height="350px" />
				</ui:treegrid>
			</div>
			<div data-options="region:'east',split:true,collapsed:true,onExpand : function(){li_east = 1;},onCollapse : function() {li_east = 0;}" style="width: 660px;">
				<div id="permission-list-panel" class="easyui-panel" title="数据字典的值" style="padding: 1px;" data-options="fit:true,border:false">
					
				</div>
			</div>
		</div>
		<script type="text/javascript">
			function addMenu(title, url, name, width, height) {
				var grid = $('#' + name),  rowsData = grid.treegrid('getSelections');
				if (rowsData && rowsData.length == 1) {
					var selected = rowsData[0];
					url = url + '&parentPermiId=' + selected['id'];
					if(selected.parentPermiId) {
						msgTip('暂时只支持二级菜单！');
						return;
					}
				}
				formSubmitDialog(title, url, name, width, height);
			}
			function viewPermission(id, permiName) {
		        var title = '查看数据字典[' + permiName + ']的字典值';
		        if(li_east == 0 || $('#dict-layout').layout('panel','east').panel('options').title != title){
		            $('#dict-layout').layout('expand','east');
		        }
		        $('#permission-list-panel').panel({ 'title': title, 'href' : 'permission.do?permissionList&permissionId=' + id });
			}
		</script>
	</body>
</html>